var ec_right1 = echarts.init(document.getElementById("r1"), "dark")

$.get('http://localhost:8080/player/playingTime', function (data) {
    var names = []
    var nums = []
    for (var i = 0; i < data.length; i++) {
        names.push(data[i].player);
        nums.push(data[i].playingTime);
    }

    // 基于准备好的dom，初始化echarts实例
    ec_right1.setOption({
        title: {
            text: 'NBA球员出场时间',
            left: "auto"
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '0%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                data: names,
                axisTick: {
                    alignWithLabel: true
                },
                axisLabel: {
                    color: '#CCC',
                }
            }
        ],
        yAxis: [
            {
                type: 'value',
                axisLabel: {
                    color: '#CCC',

                }
            },

        ],
        series: [
            {
                name: '出场时间',
                type: 'bar',
                barWidth: '60%',

                data: nums
            }
        ]
    });
})